<?php
namespace App\Params\Backend;
use App\Params\Param;
use App\Traits\DateTimeTrait;

/**
 * 优惠券发放参数
 *
 * @author: WangBin
 * @date: 2021/7/26
 * @mail: <849850352@qq.com>
 */
class CouponAssignParams extends Param
{
    use DateTimeTrait;

    public $coupon_id;
    public $type;
    public $entity_id;
    public $remark = '';
    public $num;
    public $assign_at;

    public function rules()
    {
        return [
            'coupon_id' => 'required|integer',
            'type' => 'required|string|in:GROUP,CUSTOMER',
            'entity_id' => 'required|integer',
            'remark' => 'nullable|string',
            'num' => 'required|integer|min:1|max:5',
            'assign_at' => 'nullable|string'
        ];
    }

    /**
     * @return mixed
     */
    public function getNum()
    {
        return $this->num;
    }

    /**
     * @param mixed $num
     */
    public function setNum($num): void
    {
        $this->num = $num;
    }

    /**
     * @return mixed
     */
    public function getAssignAt()
    {
        return empty($this->assign_at) ? $this->getCurrDateTime() : $this->assign_at;
    }

    /**
     * @param mixed $assign_at
     */
    public function setAssignAt($assign_at): void
    {
        $this->assign_at = $assign_at;
    }

    /**
     * @return string
     */
    public function getRemark(): string
    {
        return $this->remark;
    }

    /**
     * @param string $remark
     */
    public function setRemark(string $remark): void
    {
        $this->remark = $remark;
    }

    /**
     * @return mixed
     */
    public function getCouponId()
    {
        return $this->coupon_id;
    }

    /**
     * @param mixed $coupon_id
     */
    public function setCouponId($coupon_id): void
    {
        $this->coupon_id = $coupon_id;
    }

    /**
     * @return mixed
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @param mixed $type
     */
    public function setType($type): void
    {
        $this->type = $type;
    }

    /**
     * @return mixed
     */
    public function getEntityId()
    {
        return $this->entity_id;
    }

    /**
     * @param mixed $entity_id
     */
    public function setEntityId($entity_id): void
    {
        $this->entity_id = $entity_id;
    }
}
